//
//  BABrandOnlineCell.m
//  YunFu
//
//  Created by Bager on 2018/9/3.
//  Copyright © 2018年 yunfu. All rights reserved.
//

#import "BABrandOnlineCell.h"

@implementation BABrandOnlineCell


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.backgroundColor = HexColor(0xe8f3f8);
        [self setViews];
    }
    return self;
}

- (void)setViews
{
    [self addSubview:self.img];
    [self addSubview:self.type];
    [self addSubview:self.name];
    [self addSubview:self.detail];
}

- (UIImageView *)img
{
    if (!_img)
    {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake((kScreenWidth - kPublicMargin * 2 - 15) / 4 / 2 - 30, 15, 60, 60)];
        _img.contentMode = UIViewContentModeScaleAspectFit;
        _img.layer.masksToBounds = YES;
    }
    return _img;
}

- (UILabel *)type
{
    if (!_type)
    {
        _type = [[UILabel alloc] initWithFrame:CGRectMake(0, 90, (kScreenWidth - kPublicMargin * 2 - 15) / 4, 12)];
        _type.adjustsFontSizeToFitWidth = YES;
        _type.font = [UIFont systemFontOfSize:10];
        _type.textColor = [UIColor orangeColor];
        _type.textAlignment = NSTextAlignmentCenter;
    }
    return _type;
}


- (UILabel *)name
{
    if (!_name)
    {
        _name = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.type.frame), CGRectGetWidth(self.type.frame), 20)];
        _name.adjustsFontSizeToFitWidth = YES;
        _name.font = [UIFont systemFontOfSize:12];
        _name.textAlignment = NSTextAlignmentCenter;
    }
    return _name;
}

- (UILabel *)detail
{
    if (!_detail)
    {
        _detail = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.name.frame), CGRectGetWidth(self.type.frame), 12)];
        _detail.adjustsFontSizeToFitWidth = YES;
        _detail.font = [UIFont systemFontOfSize:10];
        _detail.textColor = [UIColor grayColor];
        _detail.textAlignment = NSTextAlignmentCenter;
    }
    return _detail;
}

@end
